cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_STANDARD 14)

# 项目名称
project(ConnectElementCalculator LANGUAGES CXX)

# 获取源文件
set(SOURCES
    Common/ConnectElementRegister.cpp
    CweldElement/ConnectElementHleper.cpp
    CweldElement/CweldCalculator.cpp
    CfastElement/CfastCalculator.cpp
    )

# 添加动态库
add_library(${PROJECT_NAME} SHARED ${SOURCES})

# 目标添加链接库
target_link_libraries(${PROJECT_NAME}
    PRIVATE BeamSecPropCalculator ElementCalculator ShellSecCalculator Constraint Integration Framework DBManager DataStructure Algebra Configuration Logging)
# 目标添加编译选项
target_compile_definitions(${PROJECT_NAME} PRIVATE EXPORTING_ConnectElement)

# 安装头文件
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Common/    DESTINATION include/SGFem/ConnectElement/Common)
# install(DIRECTORY ${PROJECT_SOURCE_DIR}/Interface/ DESTINATION include/SGFem/ElementCalculator/Interface)
# install(DIRECTORY ${PROJECT_SOURCE_DIR}/Factory/   DESTINATION include/SGFem/ElementCalculator/Factory  FILES_MATCHING PATTERN "*.h" PATTERN "UnitTest" EXCLUDE)
# install(DIRECTORY ${PROJECT_SOURCE_DIR}/Register/  DESTINATION include/SGFem/ElementCalculator/Register FILES_MATCHING PATTERN "*.h")
# install(FILES ${PROJECT_SOURCE_DIR}/TetraElement/SolidMaterialParser.h DESTINATION include/SGFem/ElementCalculator/TetraElement)

# 安装目标
install(TARGETS ${PROJECT_NAME}
    ARCHIVE DESTINATION lib
    RUNTIME DESTINATION bin)

# 添加单元测试子项目
if(SG_BUILD_UNIT_TEST)
    add_subdirectory(UnitTest)
endif()